function changenum(num) {
	$("#my_bar").css("width", num + "%");
};
var loadimg = function() {
	var imgsrc = 'image/';
	var Img = [
		"arrow2.png",
		"background.jpg",
		"background2.png",
		"ftm.png",
		"inputboxbg.png",
		"monkey.png",
		"newyearscript.png",
		"p5_back.jpg",
		"p5_dl1.png",
		"p5_dl2.png",
		"p5_hany.png",
		"p5_sun.png",
		"luokaun.png",
		"redword1.png",
		"sz.png",
		"p1_2016.png",
		"3-flower.png",
		"p2_dl.png",
		"index2_w1.png",
		"index2_w2.png",
		"index2_w3.png",
		"index2_w4.png"
	];

	function preImg(fn) {
		this.init(fn);
	};

	preImg.prototype.init = function(fn) {
		var path = Img;
		for (var i = 0; i < Img.length; i++) {
			path[i] = imgsrc + path[i];
		}
		this.isLoaded(path, fn);
	}
	preImg.prototype.isLoaded = function(imgArr, fn) {
		var arr = imgArr,
			length = arr.length,
			img = [],
			n = 0,
			error = 0;
		for (var i = 0; i < length; i++) {
			img[i] = new Image();
			img[i].src = arr[i];
			img[i].onload = function() {
				n++;
				//	                console.log(n);
				//	                $(".load").html('加载资源中'+n+'/'+length);    
				$(".load").html('Loading' + parseInt(n / length * 100) + '%');
				changenum(parseInt(n / length * 100));
				if (n == length) {
					//	                    console.log("加载完毕",length);
					fn();
				}
			}
			img[i].onerror = function() {
				n++;
				error++;
				if (n == length) {
					console.log("加载完毕但是有" + error + "张图加载失败！");
					fn();
				}
			}
		}
	}
	var preImgLoad = new preImg(function() {
		$(".loading-bar").hide();
		$("#bodyBlock").css("opacity", 1);
	});
}